<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>自动跳转</title>
		<style>
			body{
				text-align: center;
			}
			#sec{
				color: red;
				font-size: 25px;
			}
		</style>
	</head>
	<body>
		<h2>提交成功</h2>
		<a href="http://www.runoob.com">
			<span id="sec">5</span>秒后系统会自动跳转，也可以单击此链接跳转
		</a>
		<script>
			/*1、数字递减 :54321
			  2、当数字到0时，跳转到某个URL*/
			var number=5;
			var span=document.getElementById('sec');
			function jiang(){
				if(number>0){
					number--;
					span.innerHTML=number;
				}else{
					// 清除计时器，跳转
					clearInterval(timer);
					location.href="http://www.runoob.com"; 
				}
			}
			var timer=window.setInterval(jiang,1000);
		</script>
	</body>
</html>
